package com.andaily.domain.dto.thing;

import com.andaily.domain.dto.AbstractDTO;
import com.andaily.domain.thing.ThingStatus;
import com.andaily.domain.user.ThingSetting;

import java.util.List;

/**
 * Date: 13-6-24 下午11:21
 *
 * @author Shengzhao Li
 */
public class ThingSettingDto extends AbstractDTO {

    private boolean autoStartThing = false;
    private ThingStatus defaultCreatedStatus = ThingStatus.CREATED;

    public ThingSettingDto() {
    }

    public ThingSettingDto(ThingSetting thingSetting) {
        this.autoStartThing = thingSetting.autoStartThing();
        this.defaultCreatedStatus = thingSetting.defaultCreatedStatus();
    }

    public List<ThingStatus> getAvailableStatuses() {
        return ThingStatus.defaultCreatedStatuses();
    }

    public boolean isAutoStartThing() {
        return autoStartThing;
    }

    public void setAutoStartThing(boolean autoStartThing) {
        this.autoStartThing = autoStartThing;
    }

    public ThingStatus getDefaultCreatedStatus() {
        return defaultCreatedStatus;
    }

    public void setDefaultCreatedStatus(ThingStatus defaultCreatedStatus) {
        this.defaultCreatedStatus = defaultCreatedStatus;
    }

    public ThingSetting instance() {
        return new ThingSetting(this.autoStartThing, this.defaultCreatedStatus);
    }
}
